package io.lx.wechat.util;

/**
 * @Author: lx
 * @Date: 2019/7/14 0014 上午 10:12
 */

public class JSONResult {

    private Integer code;

    private String msg;

    private Object data;




    public void setResultCode(ResultCode code){
        this.code = code.code();
        this.msg = code.message();
    }

    public static JSONResult success(){
        JSONResult result = new JSONResult();
        result.setResultCode(ResultCode.SUCCESS);
        return result;
    }

    public static JSONResult success(Object data){
        JSONResult result = new JSONResult();
        result.setData(data);
        return result;
    }

    public static JSONResult success(ResultCode resultCode, Object data){
        JSONResult result = new JSONResult();
        result.setResultCode(resultCode);
        result.setData(data);
        return result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
